//
//  BaseTableViewController.swift
//  HMWeibo08
//
//  Created by 刘凡 on 15/7/27.
//  Copyright © 2015年 joyios. All rights reserved.
//

import UIKit

/// 功能模块控制器的基类控制器
class BaseTableViewController: UITableViewController, VisitorLoginViewDelegate {
    
    

    /// 用户登录成功标记
    var userLogon = false
    
    //定义
    
    /// 访客视图
    var visitorView: VisitorLoginView?
    
    override func loadView() {
        userLogon ? super.loadView() : setupVisitorView()
    }
    
    /// 设置访客视图
    private func setupVisitorView() {
        
        visitorView = VisitorLoginView()
        visitorView?.delegate = self
        view = visitorView
       navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "visitorLoginViewRegister")
        
       navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style: UIBarButtonItemStyle.Plain, target: self, action: "visitorloginViewlogin")
    }
    func visitorLoginViewRegister() {
        print("注册传递")
        
        
        
    }
    func visitorloginViewlogin() {
        print("登录传递")
        let nav = UINavigationController(rootViewController: OAuthViewController())
        
        presentViewController(nav, animated: true, completion: nil)
    }
    
 }
